package com.mobimap.nhom9.dao;

import java.util.List;
import android.database.sqlite.SQLiteDatabase;

import com.mobimap.nhom9.dao.table.PlaceTypeTable;
import com.mobimap.nhom9.dto.PlaceTypeDTO;

public class PlaceTypeDAO extends OneKeyTableDAO<PlaceTypeDTO> {

	private static final PlaceTypeTable info = new PlaceTypeTable();

	public PlaceTypeDAO(SQLiteDatabase db) {
		super(db, info);
	}
	/**
	 * Get list PlaceType - matches description
	 * @param keywork
	 * @return
	 */
	public List<PlaceTypeDTO> searchByDescription(String keywork)	{
		String param = StringHelper.FormatParamSql(keywork);
		String query = "SELECT PlaceType.* FROM PlaceType, KeyPlaceType WHERE " +
				"PlaceType.id=KeyPlaceType.PlaceTypeId AND KeyPlaceType.description Like '%" + param + "%'"; 
		return QueryHelper.rawQuery(this.database, query, null, this.table);
	}

}
